package letsjava.pattern.factory;

public class Factory{
	public static Sample creator(int which){
		if (which==1) 
			return new SampleA(); 
		else if (which==2)
			return new SampleB();
		return null;
	}
	
	public static void main(String[] args){
		Sample sampleA = Factory.creator(1);
		Sample sampleB = Factory.creator(2);
		sampleA.whoami();
		sampleB.whoami();
	}
}